include:
  - localdev
  - git.cijs_key
  
Prepare directory for PAPI Code destination:
  file.directory:
    - name: /var/www/seekasia.com/papi
    - makedirs: True

Git Clone local dev PAPI Code:
  git.latest:
    - name: git@github.com:jobstreet/papi.git
    - target: /var/www/seekasia.com/papi
    - identity: /tmp/cijs_rsa
    - unless: test -d /var/www/seekasia.com/papi/.git

Prepare api-root directory for PAPI web path:
  file.directory:
    - name: /var/www/html/api-root
    
Prepare v symlink for PAPI web path:
  file.symlink:
    - name: /var/www/html/api-root/v
    - target: /var/www/seekasia.com/papi/public

{% for phpunit_bin in [
  'vendor/bin/phpunit',
  'vendor/bin/paratest',
  'vendor/phpunit/phpunit/composer/bin/phpunit',
  'vendor/brianium/paratest/bin/paratest'
] %}
Run dos2unix on {{ phpunit_bin }}:
  cmd.run:
    - name: dos2unix /var/www/seekasia.com/papi/{{ phpunit_bin }}
{% endfor %}
